'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, middleware, jwt } = app;
  const jwtErr = middleware.jwtErr(jwt)
  router.get('/', controller.home.index);
  router.post('/register',controller.home.regsiter);
  router.get('/verify', controller.login.verify);
  router.resources('topics', '/api/v2/topics', controller.topics);
  router.resources('users','/api/v1/users',controller.v1.users);

  router.post('/login',controller.user.login)
  //router.get('/userInfo',jwt,controller.user.Info)
  router.get('/userInfo',jwtErr,controller.user.Info)
};
